<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>无标题文档</title>
		<script type="text/javascript" src="__STATIC__/js/jquery-1.8.2.min.js"></script>
		<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
		<link href="__STATIC__/uploadify/uploadify.css" type="text/css" rel="stylesheet"></link>
		<link href="__VIEW__/css/style1.css" rel="stylesheet" type="text/css" />
		<link rel="stylesheet" href="__STATIC__/css/hdjs.css" />
		<link href="__VIEW__/css/select.css" rel="stylesheet" type="text/css" />
		<script>
			var ajaxTypeAttr = "{|U:'ajaxTypeAttr'}"
		</script>
		<script type="text/javascript" src="__VIEW__/js/jquery.idTabs.min.js"></script>
		<script type="text/javascript" src="__CONTROLLER_VIEW__/js/addgoods.js"></script>
		<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.config.js"></script>
		<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/ueditor.all.js"></script>
		<script type="text/javascript" charset="utf-8" src="__STATIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
		<style type="text/css">
			select{
				opacity: 1;
				width:345px;
				height:35px;
				margin-bottom:5px;
				border:1px solid #999;
			}
		</style>
		<script>
			var ue = UE.getEditor('editor', {
				initialFrameWidth: 1000,
				initialFrameHeight: 400
			});
		</script>

	</head>

	<body>

		<div class="place">
			<span>位置：</span>
			<ul class="placeul">
				<li><a href="#">首页</a>
				</li>
				<li><a href="#">商品管理</a>
				</li>
				<li><a href="">添加商品</a>
				</li>
			</ul>
		</div>

		<div class="formbody">

			<div id="usual1" class="usual">

				<div class="itab">
					<ul>
						<li><a href="#tab1" class="selected">商品基础信息</a>
						</li>
						<li><a href="#tab2">商品属性</a>
						</li>
						<li><a href="#tab3">商品规格</a>
						</li>
						<li><a href="#tab4">商品详细信息</a>
						</li>
						<li><a href="#tab5">商品图册</a>
						</li>
					</ul>
				</div>
				<form method="post" id="goodsForm" action="{|U:'addGood'}">
					<div id="tab1" class="tabson">
						<input type="hidden" name="admin_aid" value="{$hd.session.aid}" />

						<ul class="forminfo">
							<li>
								<label>商品名<b>*</b>
								</label>
								<input name="goods_name" type="text" class="dfinput" placeholder="请输入商品名" style="width:345px;" />
							</li>
							<li>
								<label>商城价格<b>*</b>
								</label>
								<input name="shop_price" type="text" class="dfinput" placeholder="请输入商城价格" style="width:345px;" />
							</li>
							<li>
								<label>市场价</label>
								<input name="goods_market" type="text" class="dfinput" placeholder="请输入市场价" style="width:345px;" />
							</li>

							<li>
								<label>分类<b>*</b>
								</label>
								<div class="vocation">
									<select class="select1" name="goods_cateid">
										<option value="0">请选择</option>
										<foreach from="$category" key="$key" value="$val">
											<option value="{$val.cid}" type_id="{$val.type_id}">{$val._name}</option>
										</foreach>
									</select>
								</div>
								<input type="hidden" name="goods_typeid" id="goods_typeid" />
							</li>
							<!--<li>
							<label>商品状态</label>
									<label for="isok">正常<input name="goods_status" type="radio" value="1" id="isok" checked="checked"></label>
									<label for="isdown">下架<input name="goods_status" type="radio" value="0" id="isdown"></label>
							</li>-->
							<li>
							</li>
							<li>
								<label>货号</label>
								<input name="goods_sn" type="text" class="dfinput" placeholder="请输入货号" style="width:345px;" /><b>*</b>如果不输入会自动生成</li>
							<li>
								<label>品牌</label>
								<div class="vocation">
									<select class="select1" name="goods_brandid">
										<option value="0">请选择</option>
										<foreach from="$brand" key="$key" value="$val">
											<option value="{$val.bid}">{$val.bname}</option>
										</foreach>
									</select>
								</div>
							</li>
							<li>
								<label>列表图</label>
								<input name="goods_imglist" id="goods_imglist"  type="file" /> 类型: *.jpg,*.png 大小: 2000KB
								<script type="text/javascript">
								$(function() {
									//异步处理上传图片
									$('#goods_imglist').uploadify({
										'formData': { //POST数据
											'<?php echo session_name();?>': '<?php echo session_id();?>',
										},
										'fileTypeDesc': '上传文件', //上传描述
										'fileTypeExts': '*.jpg;*.png',
										'swf': '__STATIC__/uploadify/uploadify.swf',
										'uploader': '{|U:"uploadListImg"}',
										'buttonText': '选择文件',
										'fileSizeLimit': '2000KB',
										'uploadLimit': 1000, //上传文件数
										'width': 65,
//										'debug':true,
										'height': 25,
										'successTimeout': 10, //等待服务器响应时间
										'removeTimeout': 0.2, //成功显示时间
										'onUploadSuccess': function(file, data, response) {
											data = $.parseJSON(data);
											var li = '';
											var input = '';
											$.each(data,function(k,v){
												input = '<input type="hidden" name="goods_listimg" value="'+v+'"/>';
												
												 li += '<li style="height:auto;float:left;width:230px;text-align:center;"><span>'
												 li += '<img src="__ROOT__/'+v+'" width="168" height="126" /></span>';
												 li += '<h2><a href="javascript:;" >'+v+'</a></h2>';
												 li += input;
												 li += '<p><a href="javascript:;" filename="'+v+'" class="delImg">删除</a></p></li>';
											});
											//把地址放到隐藏域，这样可以提交到服务器了
											$(".goodslist").html(li);
										}
									});
								});
							</script>
							</li>
							<ul class="goodslist">
								
							</ul>
							<li>
								<label>单位</label>
								<input name="goods_unit" value="件" type="text" class="dfinput" placeholder="请输入商品单位" style="width:345px;" />
							</li>
							<li>
								<label>点击次数</label>
								<input name="goods_click" type="text" class="dfinput" placeholder="默认点击次数" style="width:345px;" />
							</li>

							<li>
								<label>&nbsp;</label>
								<input name="" type="submit" class="btn" value="添加商品" />
							</li>
						</ul>

					</div>

					<div id="tab2" class="tabson">

						<ul class="forminfo goodsattr">

						</ul>
						<ul class="forminfo">
							<li>
								<label>&nbsp;</label>
								<input name="" type="submit" class="btn" value="添加商品" />
							</li>
						</ul>

					</div>
					<div id="tab3" class="tabson">
						<ul class="forminfo goodsspec">

						</ul>
						<ul class="forminfo">
							<li>
								<label>&nbsp;</label>
								<input name="" type="submit" class="btn" value="添加商品" />
							</li>
						</ul>
					</div>
					<div id="tab4" class="tabson">
						<textarea id="editor" name="intro" rows="10" cols="10"></textarea>
						<ul class="forminfo">
							<li>
								<label>&nbsp;</label>
								<input name="" type="submit" class="btn" value="添加商品" />
							</li>
						</ul>
					</div>
					<div id="tab5" class="tabson">
						<div lab="uploadFile">
							<input id="file" type="file" multiple="true">
							<span>类型: *.jpg,*.png 大小: 2000KB 数量: 10</span>
							<script type="text/javascript">
								$(function() {
									//异步处理上传图片
									$('#file').uploadify({
										'formData': { //POST数据
											'<?php echo session_name();?>': '<?php echo session_id();?>',
										},
										'fileTypeDesc': '上传文件', //上传描述
										'fileTypeExts': '*.jpg',
										'swf': '__STATIC__/uploadify/uploadify.swf',
										'uploader': '{|U:"upload"}',
										'buttonText': '选择文件',
										'fileSizeLimit': '2000KB',
										'uploadLimit': 1000, //上传文件数
										'width': 65,
//										'debug':true,
										'height': 25,
										'successTimeout': 10, //等待服务器响应时间
										'removeTimeout': 0.2, //成功显示时间
										'onUploadSuccess': function(file, data, response) {
											data = $.parseJSON(data);
											var li = '';
//											var str = '';
											var input = '';
											input = '<input type="hidden" name="imgs[]" value="'+data.filename+'"/>';
											input += '<input type="hidden" name="ext[]" value="'+data.ext+'"/>';
											li += '<li style="height:auto;"><span>'
											li += '<img src="__ROOT__/'+data.thumb+'" width="168" height="126" /></span>';
											li += '<h2><a href="javascript:;" ></a></h2>';
											li += input;
											li += '<p><a href="javascript:;" fileext="'+data.ext+'" filename="'+data.filename+'" class="delImg">删除</a></p></li>';
											//把地址放到隐藏域，这样可以提交到服务器了
											$(".imglist").prepend(li);
										}
									});
								});
							</script>

						</div>

						<ul class="imglist"></ul>
						<input name="" type="submit" class="btn" value="添加商品" />
					</div>
			</div>

			<script type="text/javascript">
				$("#usual1 ul").idTabs();
				$('.delImg').live('click',function(){
					$isThis = $(this);
					var imgpath = $(this).attr('filename');
					var fileext = $(this).attr('fileext');
					//ajax删除那个文件
					$.ajax({
						url:'__CONTROLLER__/delImg',
						type:'post',
						data:{imgpath:imgpath,ext:fileext},
						dataType:'json',
						success:function(phpData){
							if(phpData==1){
								$isThis.parents('li').remove();	
							}
						}
					})
					
					
				});
			</script>

			<script type="text/javascript">
				$('.tablelist tbody tr:odd').addClass('odd');
			</script>
			
		</div>
		</form>
		<!--<form action="{|U:'upload'}" method="post" enctype="multipart/form-data">
		<input type="file" name="file"  />
		<input type="submit" />
	</form>		-->

	</body>

</html>